package com.sky.mapper.user;

import com.sky.anno.AutoFill;
import com.sky.dto.ShoppingCartDTO;
import com.sky.enumeration.OperationType;
import com.sky.pojo.ShoppingCart;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    ShoppingCart findByCondition(Long userid,@Param("dto") ShoppingCartDTO shoppingCartDTO);

    void updateSCart(int number, Long id);
    @AutoFill(OperationType.INSERT)
    void insertSC(ShoppingCart shoppingCart);

    @Select("select * from shopping_cart where user_id=#{currentId}")
    List<ShoppingCart> findbyUserId(Long currentId);

    @Delete("delete from shopping_cart where user_id=#{currentId}")
    void cleanAll(Long currentId);

    @Delete("delete from shopping_cart where id=#{Id}")
    void delById(Long Id);

    Integer getMakeTime(Long userId);
}
